Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MemoryView.export and MemoryView#release #80

Merged
merged 2 commits into from
Jun 17, 2021
Merged

Conversation

kou
Copy link
Member

@kou kou commented Jun 16, 2021

fix #79

Users can release memory views explicitly before process exit.

Reported by xtkoba. Thanks!!!

fix #79

Users can release memory views explicitly before process exit.

Reported by xtkoba. Thanks!!!
@kou kou requested a review from mrkn June 16, 2021 20:41
@mrkn
Copy link
Member

mrkn commented Jun 17, 2021

I think these two methods are useful. But, it seems less clear that get with a block implicitly releases the memory view at the end of the block. I want to change the name of get if we can find a more appropriate name.

@kou
Copy link
Member Author

kou commented Jun 17, 2021

get is borrowed from rb_memory_view_get_func_t.

Other candidates:

  • MemoryView.open: like File.open but MemoryView doesn't open anything
  • MemoryView.acquire: release and acquire pair is often used in "lock" context but the current context isn't "lock"
  • MemoryView.map
  • MemoryView.view

@kou
Copy link
Member Author

kou commented Jun 17, 2021

We choose MemoryView.export.

@kou kou changed the title Add MemoryView.get and MemoryView#release Add MemoryView.export and MemoryView#release Jun 17, 2021
@kou kou merged commit 1de64b7 into master Jun 17, 2021
@kou kou deleted the memory-view-release branch June 17, 2021 04:36
matzbot pushed a commit to ruby/ruby that referenced this pull request Jul 13, 2021
…le#80)

fix ruby/fiddle#79

Users can release memory views explicitly before process exit.

Reported by xtkoba. Thanks!!!

ruby/fiddle@1de64b7e76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Segfault when exiting due to Fiddle::MemoryView
2 participants